package tests;



    import java.util.*;

    public class test8 {
        public int getValue(int[] gifts, int n) {
            // write code here
            Arrays.sort(gifts);
            int mid = gifts[n/2];
            int count = 0;
            for(int s : gifts){
                if(s==mid){
                    count++;
                }
            }
            if(count>n/2){
                return mid;
            }else{
                return 0;
            }
        }
    }
